import { h } from 'vue';
import { CaretDownFilled } from '@ant-design/icons-vue';

// 定义 filterIcon 方法
const filterIcon = ({ filtered, column }: { filtered: boolean; column: any; }) => {
  return h(CaretDownFilled, {
    style: {
      color: filtered ? '#ABBACD' : undefined,
    },
    onClick: () => {
      // 这里的 onFilter 需要外部传入或通过其他方式获取
      if (column && column.onFilter) {
        column.onFilter(null, column);
      }
    },
  }) as any;
};

const commonColumns:any = {
  ruZhiShu:{
    title: '入职',
    dataIndex: 'entryNum',
    key: 'entryNum',
    sorter: true,
    tooltip: () =>  `【实习中】【试用中】【已转正】合计归属此高校的数量`,
    width: 100,
  },
  liZhiShu: {
    title: '离职',
    dataIndex: 'departNum',
    key: 'departNum',
    sorter: true,
    tooltip: () => `【离职】状态归属此高校的数量`,
    width: 100,
  },
  quanTuiShu: {
    title: '劝退',
    dataIndex: 'puaNum',
    key: 'puaNum',
    sorter: true,
    tooltip: () => `【劝退】状态归属此高校的数量`,
    width: 100,
  },
  yingJieBiYeBenKeShu:{
    title: '应届本科生',
    dataIndex: 'undergraduateCount',
    key: 'undergraduateCount',
    sorter: true,
    tooltip: () => '此高校本届应届本科生数【手填】'
  },
  jianLiLiang: {
    title: '简历量',
    dataIndex: '',
    key: '',
    sorter: true,
    tooltip: () => '此HR-渠道负责人负责的高校简历投递数量之和',
    width: 120,
  },
  daiMian:{
    title: '待面',
    dataIndex: 'waitFaceCount',
    key: 'waitFaceCount',
    sorter: true,
    tooltip: () => '【待面试】状态归属此高校的数量',
    width: 100,
  },
  daiPei:{
    title: '待培',
    dataIndex: 'waitTrainCount',
    key: 'waitTrainCount',
    sorter: true,
    tooltip: () => '【待培】状态归属此高校的数量',
    width: 100,
  },
  qiPei:{
    title: '弃培',
    dataIndex: 'giveUpTrainCount',
    key: 'giveUpTrainCount',
    sorter: true,
    tooltip: () => '【培训-待约-放弃】【培训-预约邮件已发送-放弃】状态归属此高校的数量',
    width: 100,
  },
  daoPei:{
    title: '到培',
    dataIndex: 'toTrainCount',
    key: 'toTrainCount',
    sorter: true,
    tooltip: () => '经历过【到培】状态归属此高校的数量',
    width: 100,
  },
  zhongTuFangQi:{
    title: '中途放弃',
    dataIndex: 'abandonTrainCount',
    key: 'abandonTrainCount',
    sorter: true,
    tooltip: () => '【培训-培训中-中途放弃】状态归属此高校的数量',
    width: 140,
  },
  zhongTuQuanTui:{
    title: '中途劝退',
    dataIndex: 'puaTrainCount',
    key: 'puaTrainCount',
    sorter: true,
    tooltip: () => '【培训-培训中-中途劝退】状态归属此高校的数量',
    width: 140,
  },
  guoPei:{
    title: '过培',
    dataIndex: 'passTrainCount',
    key: 'passTrainCount',
    sorter: true,
    tooltip: () => '通过录取环节归属此高校的数量',
    width: 100,
  },
  daiRuZhiYiQian:{
    title: '待入职-已签',
    dataIndex: 'waitEntryNum',
    key: 'waitEntryNum',
    sorter: true,
    tooltip: () => '【待入职】状态归属此高校的数量',
    width: 160,
  },
  daiRuZhiDaiQian:{
    title: '待入职-待签',
    dataIndex: 'waitSignEntryNum',
    key: 'waitSignEntryNum',
    sorter: true,
    tooltip: () => '【待签应约】和【待签三方】状态归属此高校的数量',
    width: 160,
  },
  daoMianShu:{
    title: '到面',
    dataIndex: 'toFaceCount',
    key: 'toFaceCount',
    sorter: true,
    tooltip: () => '经历过【到面】状态归属此高校的数量',
    width: 100,
  },
  guoMianShu: {
    title: '过面',
    key: 'passFaceCount',
    dataIndex: 'passFaceCount',
    sorter: true,
    tooltip: () => '【面试通过】归属此高校的数量',
    width: 100,
  },
  region: {
    title: '大区',
    dataIndex: 'region',
    key: 'regions',
    formType: 'select',
    customFilterDropdown: true,
    filterIcon,
    width: 100,
    tooltip:() => "此高校归属的大区"
  },
  muBiaoGaoXiao:{
    title: '目标高校',
    dataIndex: 'universityName',
    key: 'schoolName',
    fixed: 'left',
    formType: 'input',
    customFilterDropdown: true,
    filterIcon,
    width:200,
    history: true
  },
  bianJi:{
    title: '编辑',
    dataIndex: 'edit',
    fixed: 'left',
    key: 'edit',
    width: 100
  },
  daQuFuZeRen:{
    title: '大区负责人',
    dataIndex: 'regionalManager',
    key: 'regionNames',
    formType: 'select',
    otherFormType: 'search',
    customFilterDropdown: true,
    filterIcon,
    width:180,
    tooltip:() => "此高校归属大区的负责人"
  },
  quDaoFuZeRen:{
    title: '渠道负责人',
    dataIndex: 'channelManager',
    key: 'dutyNames',
    formType: 'select',
    otherFormType: 'search',
    customFilterDropdown: true,
    filterIcon,
    width:180,
    tooltip:() => "此高校的渠道负责人"
  },
  jianLi:{
    title: '简历',
    dataIndex: 'resumeCount',
    key: 'resumeCount',
    sorter: true,
    tooltip: () => '收到的简历中归属该高校的数量',
    width:100
  },
  zaiGangWeiQingChangJia: {
    title: '在岗-未请长假',
    key: 'onDutyNum',
    dataIndex: 'onDutyNum',
    sorter: true,
    tooltip: () => '在职去除离岗，归属此高校的数量',
    width: 180,
  },
  yiDaiKe: {
    title: '已带课',
    key: 'haveClassNum',
    dataIndex: 'haveClassNum',
    sorter: true,
    tooltip: () => '有【已带课】标记归属此高校的数量'
  },
  muBiao: {
    title: '目标',
    key: 'target',
    dataIndex: 'target',
    sorter: true,
    tooltip: () => '手填',
    width: 100,
  },
  muBiaoWanChengLv: {
    title: '目标完成率',
    key: 'targetCompletionRate',
    dataIndex: 'targetCompletionRate',
    sorter: true,
    tooltip: () => '此高校入职÷此高校目标',
    width: 160,
  },
  daoMianLv: {
    title: '到面率',
    key: 'toFaceRate',
    dataIndex: 'toFaceRate',
    sorter: true,
    tooltip: () => '此高校到面÷此高校约面',
    width: 120,
  },
  guoMianLv: {
    title: '过面率',
    key: 'passFaceRate',
    dataIndex: 'passFaceRate',
    sorter: true,
    tooltip: () => '此高校面试通过÷此高校到面',
    width: 120,
  },
  daoPeiLv: {
    title: '到培率',
    key: 'toTrainRate',
    dataIndex: 'toTrainRate',
    sorter: true,
    tooltip: () => '此高校到培÷此高校约培',
    width: 120,
  },
  guoPeiLv: {
    title: '过培率',
    key: 'passTrainRate',
    dataIndex: 'passTrainRate',
    sorter: true,
    tooltip: () => '此高校录取÷此高校到培',
    width: 120,
  },
  guoPeiQianYueLv: {
    title: '过培签约率',
    key: 'passTrainSignRate',
    dataIndex: 'passTrainSignRate',
    sorter: true,
    tooltip: () => '此高校待入职÷此高校录取',
    width: 160,
  },
  guoPeiRuZhiLv: {
    title: '过培入职率',
    key: 'passTrainEntryRate',
    dataIndex: 'passTrainEntryRate',
    sorter: true,
    tooltip: () => '此高校入职÷此高校录取',
    width: 160,
  },
}

export const tableColumnsData: any = [
  commonColumns.muBiaoGaoXiao,
  commonColumns.bianJi,
  commonColumns.jianLi,
  commonColumns.region,
  commonColumns.daQuFuZeRen,
  commonColumns.quDaoFuZeRen,
  commonColumns.yingJieBiYeBenKeShu,
  commonColumns.jianLiLiang,
  commonColumns.daiMian,
  commonColumns.daoMianShu,
  commonColumns.guoMianShu,
  commonColumns.daiPei,
  commonColumns.qiPei,
  commonColumns.daoPei,
  commonColumns.zhongTuFangQi,
  commonColumns.zhongTuQuanTui,
  commonColumns.guoPei,
  commonColumns.daiRuZhiYiQian,
  commonColumns.daiRuZhiDaiQian,
  commonColumns.ruZhiShu,
  commonColumns.liZhiShu,
  commonColumns.quanTuiShu,
  commonColumns.zaiGangWeiQingChangJia,
  commonColumns.yiDaiKe,
  commonColumns.muBiao,
  commonColumns.muBiaoWanChengLv,
  commonColumns.daoMianLv,
  commonColumns.guoMianLv,
  commonColumns.daoPeiLv,
  commonColumns.guoPeiLv,
  commonColumns.guoPeiQianYueLv,
  commonColumns.guoPeiRuZhiLv
]


export const selectOptions: any = {
  schoolName: {
    placeholder: '目标高校',
    inputValue: ''
  },
  regions: {
    requestType: 'DEPT',
    requestApi: 'selectCommonConfigDetail',
    placeholder: '所属大区',
    option: []
  },
  dutyNames: {
    requestType: 'HR',
    requestApi: 'selectUserByRole',
    placeholder: '渠道负责人',
    option: []
  },
  regionNames: {
    requestType: 'LOCATION',
    requestApi: 'selectUserByRole',
    placeholder: '大区负责人',
    option: []
  },
}




